HTMLify

style.css
Views: 38 | Author: cody
@import url("https://fonts.googleapis.com/css2?family=Akaya+Telivigala&display=swap");

:root {
  --main-color: #e4e0ef;
  --light-color: #301c17;
  --border-color: #ada3d4;
  --border-color-secondary: #473fb5;
  --shadow-color: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--main-color);
  color: var(--light-color);
  font-family: "Akaya Telivigala", cursive;
  margin: 0;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 4rem;
  margin: 1rem;
}

.header img {
  width: 32px;
  width: 32px;
}

.header h1 {
  padding-left: 0.5rem;
}

.container {
  margin: auto;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flex {
  display: flex;
  align-items: center;
}

input,
button {
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  font-size: 14px;
  padding: 8px 10px;
  margin: 0;
}

input[type="text"] {
  width: 100%;
}

button {
  background-color: var(--border-color-secondary);
  color: var(--main-color);
}

input[type="text"]:focus,
button:focus {
  outline: none;
}

button:active {
  transform: scale(0.98);
}

.search-btn {
  cursor: pointer;
  border-left: 0;
  border-radius: 0;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.random-btn {
  cursor: pointer;
  margin-left: 10px;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.meals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.meal {
  cursor: pointer;
  position: relative;
  height: 180px;
  width: 180px;
  text-align: center;
}

.meal img {
  width: 100%;
  height: 100%;
  border: 4px var(--border-color) solid;
  border-radius: 2px;
}

.meal-info {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: var(--shadow-color);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

.meal:hover .meal-info {
  color: var(--main-color);
  opacity: 1;
}

.single-meal {
  margin: 30px auto;
  width: 70%;
}

.single-meal img {
  width: 300px;
  margin: 15px;
  border: 4px var(--border-color) solid;
  border-radius: 2px;
}

.single-meal-info {
  margin: 20px;
  padding: 10px;
  border: 2px var(--border-color-secondary) dashed;
  border-radius: 5px;
}

.single-meal p {
  margin: 0;
  letter-spacing: 0.5px;
  line-height: 1.5;
  text-align: left;
}

.single-meal ul {
  padding-left: 0;
  list-style-type: none;
}

.single-meal ul li {
  border: 1px var(--border-color) solid;
  border-radius: 5px;
  background-color: var(--light-color);
  display: inline-block;
  color: var(--main-color);
  font-size: 1.1rem;
  padding: 5px;
  margin: 0 5px 5px 0;
}

@media (min-width: 740px) {
  .header {
    flex-direction: row;
  }

  .header h1 {
    padding-right: 2rem;
  }

  input[type="text"] {
    width: 300px;
  }

  .meals {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 940px) {
  .meals {
    grid-template-columns: repeat(4, 1fr);
  }
}

Comments